package com.ruoyi.transfers.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.exitwarehouse.domain.WExitWarehouseInfo;
import com.ruoyi.goods.domain.TGoodsWeightSum;
import com.ruoyi.transfers.domain.TimeLineActivity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.transfers.mapper.WGoodsTransferInfoMapper;
import com.ruoyi.transfers.domain.WGoodsTransferInfo;
import com.ruoyi.transfers.service.IWGoodsTransferInfoService;

/**
 * 货转信息Service业务层处理
 * 
 * @author wzy
 * @date 2024-09-09 13:25:55
 */
@Service
public class WGoodsTransferInfoServiceImpl implements IWGoodsTransferInfoService 
{
    @Autowired
    private WGoodsTransferInfoMapper wGoodsTransferInfoMapper;

    /**
     * 查询货转信息
     * 
     * @param goodsTransferId 货转信息主键
     * @return 货转信息
     */
    @Override
    public WGoodsTransferInfo selectWGoodsTransferInfoByGoodsTransferId(Long goodsTransferId)
    {
        return wGoodsTransferInfoMapper.selectWGoodsTransferInfoByGoodsTransferId(goodsTransferId);
    }

    /**
     * 查询货转信息列表
     * 
     * @param wGoodsTransferInfo 货转信息
     * @return 货转信息
     */
    @Override
    public List<WGoodsTransferInfo> selectWGoodsTransferInfoList(WGoodsTransferInfo wGoodsTransferInfo)
    {
        return wGoodsTransferInfoMapper.selectWGoodsTransferInfoList(wGoodsTransferInfo);
    }

    /**
     * 新增货转信息
     * 
     * @param wGoodsTransferInfo 货转信息
     * @return 结果
     */
    @Override
    public int insertWGoodsTransferInfo(WGoodsTransferInfo wGoodsTransferInfo)
    {
        wGoodsTransferInfo.setCreateTime(DateUtils.getNowDate());
        return wGoodsTransferInfoMapper.insertWGoodsTransferInfo(wGoodsTransferInfo);
    }

    /**
     * 修改货转信息
     * 
     * @param wGoodsTransferInfo 货转信息
     * @return 结果
     */
    @Override
    public int updateWGoodsTransferInfo(WGoodsTransferInfo wGoodsTransferInfo)
    {
        wGoodsTransferInfo.setUpdateTime(DateUtils.getNowDate());
        return wGoodsTransferInfoMapper.updateWGoodsTransferInfo(wGoodsTransferInfo);
    }

    /**
     * 批量删除货转信息
     * 
     * @param goodsTransferIds 需要删除的货转信息主键
     * @return 结果
     */
    @Override
    public int deleteWGoodsTransferInfoByGoodsTransferIds(Long[] goodsTransferIds)
    {
        return wGoodsTransferInfoMapper.deleteWGoodsTransferInfoByGoodsTransferIds(goodsTransferIds);
    }

    /**
     * 删除货转信息信息
     * 
     * @param goodsTransferId 货转信息主键
     * @return 结果
     */
    @Override
    public int deleteWGoodsTransferInfoByGoodsTransferId(Long goodsTransferId)
    {
        return wGoodsTransferInfoMapper.deleteWGoodsTransferInfoByGoodsTransferId(goodsTransferId);
    }

    /**
     * 查询货转信息列表
     *
     * @param goodsIds 货转信息
     * @return 货转信息
     */
    @Override
    public List<WGoodsTransferInfo> selectWGoodsTransferInfoByGoodsId(List<Long> goodsIds, Long goodsTransferId)
    {
        return wGoodsTransferInfoMapper.selectWGoodsTransferInfoByGoodsId(goodsIds, goodsTransferId);
    }

    /**
     * 批量删除货转信息
     *
     * @param goodsTransferIds 需要删除的货转信息主键
     * @return 结果
     */
    @Override
    public List<TimeLineActivity> selectTimeLineActivityByGoodsTransferId(String goodsTransferIds)
    {
        return wGoodsTransferInfoMapper.selectTimeLineActivityByGoodsTransferId(goodsTransferIds);
    }

    /**
     * 修改货转信息
     *
     * @param goodsTransferId 货转信息
     * @return 结果
     */
    @Override
    public int updateWTransferTotalWeightPieceByGoodsTransferId(Long goodsTransferId)
    {
//        WGoodsTransferInfo wGoodsTransferInfo = new WGoodsTransferInfo();
//        wGoodsTransferInfo.setUpdateTime(DateUtils.getNowDate());
//        return wGoodsTransferInfoMapper.updateWGoodsTransferInfo(wGoodsTransferInfo);
        return wGoodsTransferInfoMapper.updateWTransferTotalWeightPieceByGoodsTransferId(goodsTransferId);
    }

    /**
     * 获取货物重量合计
     *
     * @param wGoodsTransferInfo 货物信息参数
     * @return 结果
     */
    @Override
    public List<TGoodsWeightSum> getWeightSumByGoodsTransferInfo(WGoodsTransferInfo wGoodsTransferInfo)
    {
        return wGoodsTransferInfoMapper.getWeightSumByGoodsTransferInfo(wGoodsTransferInfo);
    }

}
